package com.ydh.company.config;

import com.ydh.company.interceptor.LoginInterceptor;
import org.omg.PortableInterceptor.Interceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器的注册配置
 */

@Configuration
public class interceptorConfig implements WebMvcConfigurer {

    /**
     * 注册拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册
        registry.addInterceptor(new LoginInterceptor())
                //拦截路径
                .addPathPatterns("/**")
                //定义放行路径
                .excludePathPatterns("/Login/**")
                .excludePathPatterns("/announcement/**")
                .excludePathPatterns("/goods/**");

    }
}
